package com.sjp.blog.utils;


import com.sjp.blog.common.vo.Response;

/**
 * 统一返回参数生成器
 * <p>
 * Created by zyhuang on 2017/6/16.
 */
public class ResponseUtil {
    public static <T> Response<T> success() {
        Response<T> result = Response.newInstance();
        result.setSuccess(true);
        return result;
    }

    public static <T> Response<T> success(T data) {
        Response<T> result = success();
        result.setData(data);
        return result;
    }

    public static <T> Response<T> success(T data, String message) {
        Response<T> result = success();
        result.setData(data);
        result.setMessage(message);
        return result;
    }

}
